package com.mes.common.dao.iface;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.hibernate.criterion.DetachedCriteria;

import com.bstek.dorado.data.provider.Page;

public interface IBasicDao<T> {

	public void add(T t) throws Exception; 

	public void update(T t) throws Exception;
	
	public void delete(T t) throws Exception;
	
	public void save(T t) throws Exception;

	public List<T> loadAll(Class<T> clazz) throws Exception;

	public T load(Class<T> clazz, Serializable id) throws Exception;

	public T get(Class<T> clazz, Serializable id) throws Exception;

	public List<T> loadAll() throws Exception;
	
	public T load(Serializable id) throws Exception;

	public T getById(Serializable id) throws Exception;
	
	public void add(Collection<T> collection) throws Exception;
	
	public void update(Collection<T> collection) throws Exception;
	
	public void delete(Collection<T> collection) throws Exception;
	
	public void loadAll(Page<T> page) throws Exception;
	
	public List<T> findByProperty(String propertyName, Object value)
			throws Exception;

	public List<T> findByProperty(String propertyName, Object value, String orderBy)
			throws Exception;

	public List<T> findByProperty(String propertyName, Object value,
			String orderBy, boolean isDesc) throws Exception;
	
	public void pagingQuery(Page<?> page, String queryString, String countQueryString, Object[] parameters,
			Map<String, Object> parametersMap, String dataSourceName) throws Exception;
	
	public void pagingQuery(Page<?> page, DetachedCriteria detachedCriteria, String dataSourceName);
	
	public void pagingQuery(Page<?> page, DetachedCriteria detachedCriteria);

	public List<T> query(DetachedCriteria detachedCriteria, String dataSourceName);
	
	public Collection<?> query(DetachedCriteria detachedCriteria);

	public List<T> query(DetachedCriteria detachedCriteria, int pageIndex, int pageSize, String dataSourceName);

	public Collection<?> query(DetachedCriteria detachedCriteria, int pageIndex, int pageSize);
	
	public List<T> query(String queryString, Map<String, Object> parametersMap, int pageIndex, int pageSize,
			String dataSourceName);
	
	public <T> List<T> query(String hql);
	
	public <T> List<T> query(String hql, String dataSourceName);
	
	public <T> List<T> query(String hql, Map<String, Object> parameterMap);
	
	public <T> List<T> query(String hql, Map<String, Object> parameterMap, String dataSourceName);
	
	public <T> List<T> query(String hql, Object[] parameters, Map<String, Object> parameterMap, String dataSourceName);
	
	public List<T> getByOutUid(String outUid) throws Exception;
	
	public T getSingleByOutUid(String outUid) throws Exception;
	
}
